import java.sql.Array;
import java.util.Arrays;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Administrator
 * Date: 2023-08-09
 * Time: 14:37
 */
class Tests {
    static boolean foo(char c) {
        System.out.print(c);
        return true;
    }
}
public class Test {
    public static void mystery (int x){
        System.out.println(x % 10);
        if(x / 10 != 0){
            mystery(x / 10);
        }
        System.out.println(x % 10);
    }
    public static int searchInsert(int[] nums, int target) {
        int count = 0;
        for (int i = 0; i < nums.length; i++) {
            if(nums[i] != target){
               count++;
            }else {
               return count;
            }
        }
        if(count == nums.length){
            count = 0;
            for (int i = 0; i < nums.length; i++) {
                if(nums[i] < target){
                    count++;
                }else {
                    return count;
                }
            }
        }

        return count;
    }

    public static boolean isPalindrome(int x) {
        if(x < 0){
            return false;
        }
        String str = String.valueOf(x);
        int len = str.length();
        char[] arry = new char[len];
        for (int i = 0; i < len; i++) {
            char ch = str.charAt(i);
            arry[i] = ch;
        }
        int left = 0;
        int right = len - 1;
        while (left < right){
            if(arry[left] == arry[right]){
                left++;
                right--;
            }else {
                return false;
            }
        }
        return true;
    }




/*    public static void main(String[] args) {
        int i = 0;
        for ( foo('A'); foo('B') && (i < 2); foo('C')) {
            i++;
            foo('D');
        }
    }*/
    public static void main2(String[] args) {
        int x = 1211;
        boolean ret = isPalindrome(x);
        System.out.println(ret);
    }
    public static void main1(String[] args) {
       // mystery(1234);
        int[] arry = {1,3,5,6};
        int ret = searchInsert(arry,5);
        System.out.println(ret);
    }
}
